﻿using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using WPFPrism.ViewModels;
using WPFPrism.Views;

namespace WPFPrism
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            //通过容器去拿MainView,也是启动的地方
            return Container.Resolve<MainView>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            //依赖注入的功能，增加依赖注入要实现的内容
            //containerRegistry.RegisterForNavigation<ViewA>(); //containerRegistry.RegisterForNavigation<ViewA>("ViewA的具体名字")自定义，可以这样写;



            containerRegistry.RegisterForNavigation<IndexView, IndexViewModel>();
            containerRegistry.RegisterForNavigation<MemoView, MemoViewModel>();
            containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
            containerRegistry.RegisterForNavigation<ToDoView, ToDoViewModel>();

            containerRegistry.RegisterForNavigation<SkinView, SkinViewModel>();
            containerRegistry.RegisterForNavigation<AboutView, AboutViewModel>();
            containerRegistry.RegisterForNavigation<SystemConfigView, SystemConfigViewModel>();
            


            //注册弹框提示的界面
        }

        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            //这里是走代码的
            //moduleCatalog.AddModule<ModuleAfile>();//加载A模块
            //moduleCatalog.AddModule<ModuleBfile>();//加载B模块
            base.ConfigureModuleCatalog(moduleCatalog);
        }
        protected override IModuleCatalog CreateModuleCatalog()
        {
            //这里是走配置的
            //return new DirectoryModuleCatalog()
            //{
            //    ModulePath = @"Modules"//这里是主程序exe同文件夹下面的Modules文件夹
            //};
            return base.CreateModuleCatalog();
        }

    }
}
